package com.stx.day1011;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class DeserializationDemo {
    public static void main(String[] args) {
        //反序列化 - user
        try {
            //打开序列化文件
            FileInputStream fis = null;
            try {
                fis = new FileInputStream("D:\\Files\\dome\\stx_six\\src\\com\\stx\\day1011\\001.txt");
            } catch (FileNotFoundException ex) {
                throw new RuntimeException(ex);
            }
            //反序列化
            ObjectInputStream ois = new ObjectInputStream(fis);
            //读取文件
            User user = (User) ois.readObject();
            System.out.println(user);
            fis.close();
            ois.close();
        } catch (ClassNotFoundException | IOException e) {
            throw new RuntimeException(e);
        }
    }
}
